<?php
/**
 * EDIT FORM View Helper
*/
class Zend_View_Helper_EditForm extends Zend_View_Helper_Abstract
{
   
    
    protected $_title;
    protected $_description;
    protected $_introduction;
    protected $_city;
    protected $_country;
    protected $_region;
    
    protected $_priority;
    
    protected $_seo;
    
    
    public function editForm($form)
    {
        $this->_form = $form;
        return $this;
    }
    public function editTitle()
    {
        $this->_title =
        '<a id="multi_expand_titles" class="multi_language_expand closed">&nbsp;</a>
	        <div id="titles" class="field-wrapper">
	        <div id="zone_title_vi" class="zone default">'.
	        		$this->_form->titleVi.'
	        	</div>
	        	<div id="zone_title_en" class="zone" style="display:none;">'.
	        		$this->_form->titleEn.'			
	        	</div>
	        	<div id="zone_title_ja" class="zone" style="display:none;">'.
	        		$this->_form->titleJa.'			
	        	</div>			
	        	<div id="zone_title_zh" class="zone" style="display:none;">
	        		'.$this->_form->titleZh.'			
	        	</div>			
	        	<div id="zone_title_fr" class="zone" style="display:none;">
	        		'.$this->_form->titleFr.'		
	        	</div>			
	        </div>';
        
        	return $this;
    }
    public function editDescription()
    {
        $this->_description =
       '<a id="multi_expand_descriptions" class="multi_language_expand closed help">&nbsp;</a>
			<div id="descriptions" class="field-wrapper">
				<div id="zone_desc_vi" class="zone default">
					'.$this->_form->descVi.'			
				</div>
				<div id="zone_desc_en" class="zone" style="display:none;">
					'.$this->_form->descEn.'			
				</div>
				<div id="zone_desc_ja" class="zone" style="display:none;">
					'.$this->_form->descJa.'			
				</div>
				<div id="zone_desc_zh" class="zone" style="display:none;">
					'.$this->_form->descZh.'			
				</div>
				<div id="zone_desc_fr" class="zone" style="display:none;">
					'.$this->_form->descFr.'			
				</div>
			</div>';
       return $this;
    }
    public function editIntroduction()
    {
        $this->_introduction =
        '<a id="multi_expand_intros" class="multi_language_expand closed">&nbsp;</a>
			<div id="intros" class="field-wrapper">
				<div id="zone_intro_vi" class="zone default">
					'.$this->_form->introVi.'		
				</div>
				<div id="zone_intro_en" class="zone" style="display:none;">
					'.$this->_form->introEn.'			
				</div>
				<div id="zone_intro_ja" class="zone" style="display:none;">
					'.$this->_form->introJa.'			
				</div>
				<div id="zone_intro_zh" class="zone" style="display:none;">
					'.$this->_form->introZh.'			
				</div>
				<div id="zone_intro_fr" class="zone" style="display:none;">
					'.$this->_form->introFr.'			
				</div>
			</div>';
        return $this;
    }
    public function editCountry()
    {
    	$this->_country =
    		'<div class="form-item">
				<label for="status">Country</label>
				<div class="field-wrapper">
					'.$this->_form->countryid.'
				</div>
				<div class="clear" ></div>
			</div>';
    	return $this;
    }
    public function editRegion()
    {
        $this->_region =
	        '<div class="form-item">
		        <label for="status">Region</label>
		        <div class="field-wrapper">
		        	'.$this->_form->regionid.'
		        </div>
		        <div class="clear" ></div>
	        </div>';
        return $this;
    }
    public function editCity()
    {
        $this->_city =
	        '<div class="form-item">
		        <label for="status">City</label>
		        <div class="field-wrapper">
		        	'.$this->_form->cityid.'
		        </div>
		        <div class="clear" ></div>
	        </div>';
        return $this;
    }
    public function editPriority()
    {
    	$this->_priority = 
    	'<div class="form-item">
			<label for="status">Priority</label>
			<div class="field-wrapper">
				'.$this->_form->priority.'	
				<div class="clear" ></div>
			</div>
		</div>';
    	return $this;
    }
    public function editSeo()
    {
    	$this->_seo=
    '<fieldset class="form-group" >
		<legend>SEO</legend>			
			<a class="expand"><span class="icon-button mini"></span>Minimize</a>
				
			<div>'.
    		'<div class="form-item">
				<a id="multi_expand_aliases" class="multi_language_expand closed">&nbsp;</a>
				<div id="aliases" class="field-wrapper">
					<div id="zone_alias_vi" class="zone default">
						'. $this->_form->aliasVi.'			
					</div>
					<div id="zone_alias_en" class="zone" style="display:none;">
						'. $this->_form->aliasEn.'			
					</div>
					<div id="zone_alias_ja" class="zone" style="display:none;">
						'. $this->_form->aliasJa.'			
					</div>			
					<div id="zone_alias_zh" class="zone" style="display:none;">
						'. $this->_form->aliasZh.'			
					</div>			
					<div id="zone_alias_fr" class="zone" style="display:none;">
						'. $this->_form->aliasFr.'			
					</div>			
				</div>
				<div class="clear"></div>
			</div>
			
			<div class="form-item">
				<a id="multi_expand_metatages" class="multi_language_expand closed">&nbsp;</a>
				<div id="metatages" class="field-wrapper">
					<div id="zone_metatag_vi" class="zone default">
						'. $this->_form->metatagVi.'			
					</div>
					<div id="zone_metatag_en" class="zone" style="display:none;">
						'. $this->_form->metatagEn.'			
					</div>
					<div id="zone_metatag_ja" class="zone" style="display:none;">
						'. $this->_form->metatagJa.'			
					</div>			
					<div id="zone_metatag_zh" class="zone" style="display:none;">
						'. $this->_form->metatagZh.'			
					</div>			
					<div id="zone_metatag_fr" class="zone" style="display:none;">
						'. $this->_form->metatagFr.'			
					</div>			
				</div>
				<div class="clear"></div>
			</div>
			
			<div class="form-item">
				<a id="multi_expand_keywordes" class="multi_language_expand closed">&nbsp;</a>
				<div id="keywordes" class="field-wrapper">
					<div id="zone_keyword_vi" class="zone default">
						'. $this->_form->keywordVi.'			
					</div>
					<div id="zone_keyword_en" class="zone" style="display:none;">
						'. $this->_form->keywordEn.'			
					</div>
					<div id="zone_keyword_ja" class="zone" style="display:none;">
						'. $this->_form->keywordJa.'			
					</div>			
					<div id="zone_keyword_zh" class="zone" style="display:none;">
						'. $this->_form->keywordZh.'			
					</div>			
					<div id="zone_keyword_fr" class="zone" style="display:none;">
						'. $this->_form->keywordFr.'			
					</div>			
				</div>
				<div class="clear"></div>
			</div>'.
    	'</div>
					
		</fieldset>';
    	return $this;
    }
    
    public function toString()
    {
    	$xhtml='<form id="content" method="post" enctype="multipart/form-data" >
					<div class="detail-infomation-left">';
    	$xhtml.='<fieldset class="form-group" >
					<legend>Informations</legend>			
					<a class="expand"><span class="icon-button mini"></span>Minimize</a>
					
					<div>	
					
						<div class="form-item">'.$this->_title.'		
							<div class="clear"></div>
						</div>
						
						<div class="form-item">'.$this->_description.'		
							<div class="clear"></div>
						</div>
						<div class="form-item">'.$this->_introduction.'		
							<div class="clear"></div>
						</div>
					</div>
					
				</fieldset>'.
				$this->_seo
				.'<div class="detail-infomation-button" >
				    <?php //TODO : Create an helper for the validation buttons ?>
				 	<input type="submit" class="button submit" value="Save" />
				 	<input type="submit" class="button submit" value="Save and Addanother" />
				</div>
				
			</div>';
    	$xhtml.='<div class="detail-infomation-right" >
					<fieldset class="form-aside" >'.$this->langTab('small').
						'<fieldset class="form-group-right" >
							<legend>Publish</legend>
							<div class="form-item">				
								<label for="status">Status</label>
								<div class="field-wrapper">
									<div style="float:left;">
									<span id="status_1" class="on" >Status </span>
									</div>
								</div>
								<div class="clear" ></div>
							</div>'.
							$this->_priority
							.'<div style="display: none;" >
								<div id="content_properties" >
									'.$this->_form->status.'	
								</div>
							</div>
						</fieldset>'.
						'<fieldset class="form-group-right" >
							<legend>Location</legend>'.
							$this->_country.$this->_region.$this->_city.
						'</fieldset>
					</fieldset>
				</div>	
			</form>';
    	return $xhtml;
    }

    
    private function langTab($style)
    {
        $xhtml = '<div id="lang_indicator" class="'.$style.'">'."\n";
        $xhtml .= '<span id="btn_flag_vi" class="btn_flag"></span>'."\n";
        $xhtml .= '<span id="btn_flag_en" class="btn_flag"></span>'."\n";
        $xhtml .= '<span id="btn_flag_ja" class="btn_flag"></span>'."\n";
        $xhtml .= '<span id="btn_flag_zh" class="btn_flag"></span>'."\n";
        $xhtml .= '<span id="btn_flag_fr" class="btn_flag"></span>'."\n";
        $xhtml .= '</div>'."\n";
        
        return $xhtml;
    }
    
}
?>